package com.lbd.commons.event;

import org.springframework.context.ApplicationEvent;

/**
 * Created by WangYajie on 2016/8/31.
 */
public abstract class AbstractEvent<T> extends ApplicationEvent {

    public EventState eventState;
    public T entity;
    public String message;


    private AbstractEvent(Object source) {
        super(source);
    }

    public AbstractEvent(Object source, T entity, EventState eventState) {
        this(source);
        this.eventState = eventState;
        this.entity = entity;
    }

    public AbstractEvent(Object source, T entity, EventState eventState, String message) {
        this(source, entity, eventState);
        this.message = message;
    }

    public AbstractEvent(Object source, T entity) {
        this(source, entity, EventState.SUCCESS);
    }

    public T getEntity() {
        return entity;
    }

    public String getMessage() {
        return this.message;
    }
}
